package geez.widget;

import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
import static geez.widget.Geez.withStyle;

public class GHorizontalPanel<T extends GHorizontalPanel> extends HorizontalPanel {

    public T id(String id) {
        Geez.withNameAndId(this, id);
        return downcastSelft();
    }

    public T css(String cssClass, String... optionalClasses) {
        withStyle(this, cssClass, optionalClasses);
        return downcastSelft();
    }

    public T append(Widget widget) {
        add(widget);
        return downcastSelft();
    }

    private T downcastSelft() {
        //noinspection unchecked
        return (T) this;
    }
}